<?php

/**
 * Conducteur form base class.
 *
 * @method Conducteur getObject() Returns the current form's model object
 *
 * @package    SdCommerce
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseConducteurForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'             => new sfWidgetFormInputHidden(),
      'code'           => new sfWidgetFormInputText(),
      'nom'            => new sfWidgetFormInputText(),
      'prenom'         => new sfWidgetFormInputText(),
      'telephone'      => new sfWidgetFormInputText(),
      'commission'     => new sfWidgetFormInputText(),
      'bloque'         => new sfWidgetFormInputCheckbox(),
      'principal'      => new sfWidgetFormInputCheckbox(),
      'civilite'       => new sfWidgetFormChoice(array('choices' => array('Mr' => 'Mr', 'Mlle' => 'Mlle', 'Mme' => 'Mme'))),
      'datePermis'     => new sfWidgetFormDate(),
      'typePermis'     => new sfWidgetFormChoice(array('choices' => array('A' => 'A', 'B' => 'B'))),
      'departement_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Departement'), 'add_empty' => true)),
      'ville_id'       => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Ville'), 'add_empty' => true)),
      'created_at'     => new sfWidgetFormDateTime(),
      'updated_at'     => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'             => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'code'           => new sfValidatorString(array('max_length' => 100, 'required' => false)),
      'nom'            => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'prenom'         => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'telephone'      => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'commission'     => new sfValidatorNumber(array('required' => false)),
      'bloque'         => new sfValidatorBoolean(array('required' => false)),
      'principal'      => new sfValidatorBoolean(array('required' => false)),
      'civilite'       => new sfValidatorChoice(array('choices' => array(0 => 'Mr', 1 => 'Mlle', 2 => 'Mme'))),
      'datePermis'     => new sfValidatorDate(array('required' => false)),
      'typePermis'     => new sfValidatorChoice(array('choices' => array(0 => 'A', 1 => 'B'), 'required' => false)),
      'departement_id' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Departement'), 'required' => false)),
      'ville_id'       => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Ville'), 'required' => false)),
      'created_at'     => new sfValidatorDateTime(),
      'updated_at'     => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('conducteur[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Conducteur';
  }

}
